package com.audit.service.impl;

import com.audit.mapper.AuditMapper;
import com.audit.service.AuditService;
import com.common.entity.audit.TbAudit;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 蛋儿
 * @date 2021/8/11 19:45
 */

@Service
public class AuditServiceImpl implements AuditService {

    @Autowired
    private AuditMapper auditMapper;

    /**
     * 审核管理列表
     * @param page
     * @param size
     * @param audit
     * @return
     */
    @Override
    public PageInfo<TbAudit> findAll(Integer page, Integer size, TbAudit audit) {
        PageHelper.startPage(page,size);
        List<TbAudit> list = auditMapper.findAll(audit);
        return new PageInfo<>(list);
    }

    /**
     * 审核删除
     * @param id
     */
    @Override
    public void delete(Long id) {
        auditMapper.delete(id);
    }

    /**、
     * 查询单条数据
     * @param id
     * @return
     */
    @Override
    public TbAudit findOne(Long id) {
        return auditMapper.findOne(id);
    }

    /**
     * 修改
     * @param audit
     */
    @Override
    public void update(TbAudit audit) {
        auditMapper.update(audit);
    }

    /**
     * 审核状态
     * @param id
     * @param status
     */
    @Override
    public void updateStatus(Long id, Integer status) {
        auditMapper.updateStatus(id,status);
    }
}
